package com.qf.business.redenvlopes.listener;

import com.ken.event.action.apply.consumer.IKenEventHandler;
import com.ken.event.action.apply.consumer.KenEvent;
import com.ken.event.standard.entity.KenMessage;
import com.qf.business.redenvlopes.service.RedEnvlopesService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * 红包回退消息的监听器
 * author Ken
 * create_time 2022/12/7
 */
@KenEvent("red-back")
@Slf4j
public class RedBackHandler implements IKenEventHandler<Long> {

    @Autowired
    private RedEnvlopesService redEnvlopesService;

    @Override
    public void eventHandler(Long data, KenMessage kenMessage) {
        log.debug("接收到延迟消息-{}", data);
        //执行当前红包的过期业务
        redEnvlopesService.redBack(data);
    }
}
